From d40db2be59d7a7b26b904993d6ac071d94c3f2eb Mon Sep 17 00:00:00 2001 From: "rac61@labyrinth.cl.cam.ac.uk" Date: Thu, 10 Jul 2003 10:17:15 +0000 Subject: [PATCH] bitkeeper revision 1.330 (3f0d3d2bKhsLvy6rQeImnM5nqYXVnw) Implement physical disk management in web interface --- .rootkeys | 9 +- BitKeeper/etc/ignore | 6 ++ tools/control/{README-xenctl => README-web} | 2 +- tools/control/web/tmpl/index.tmpl | 1 + tools/control/web/tmpl/makefile | 9 +- tools/control/web/tmpl/pd-g.tmpl | 99 +++++++++++++++++++ tools/control/web/tmpl/pd-gr.tmpl | 77 +++++++++++++++ tools/control/web/tmpl/pd-l.tmpl | 90 +++++++++++++++++ tools/control/web/tmpl/pd-r.tmpl | 104 ++++++++++++++++++++ tools/control/web/tmpl/pd-rr.tmpl | 50 ++++++++++ tools/control/web/tmpl/pd.tmpl | 24 +++++ tools/control/web/tmpl/pdmenu.tmpl | 26 +++++ tools/control/web/tmpl/xenohead.def | 1 + 13 files changed, 493 insertions(+), 5 deletions(-) rename tools/control/{README-xenctl => README-web} (95%) create mode 100644 tools/control/web/tmpl/pd-g.tmpl create mode 100644 tools/control/web/tmpl/pd-gr.tmpl create mode 100644 tools/control/web/tmpl/pd-l.tmpl create mode 100644 tools/control/web/tmpl/pd-r.tmpl create mode 100644 tools/control/web/tmpl/pd-rr.tmpl create mode 100644 tools/control/web/tmpl/pd.tmpl create mode 100644 tools/control/web/tmpl/pdmenu.tmpl diff --git a/.rootkeys b/.rootkeys index 27af6a71b1..b38025b6ca 100644 --- a/.rootkeys +++ b/.rootkeys @@ -7,7 +7,7 @@ 3e6377d6eiFjF1hHIS6JEIOFk62xSA tools/balloon/README 3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c 3eb781edFwm_pW9FwnQACIe68viLOw tools/control/Makefile -3eca6a96a31IwaKtkEa4jmzwTWlm8Q tools/control/README-xenctl +3eca6a96a31IwaKtkEa4jmzwTWlm8Q tools/control/README-web 3eb781fceEYkUi1XHKf2V0KX7si2JA tools/control/build-cmdline.xml 3ec41f7cWCxQ8pdH8ZWqhhv-38qQ1w tools/control/build-web.xml 3ec41f7ca6IBXDSe0HVcMPp3PPloOQ tools/control/build.properties @@ -95,6 +95,13 @@ 3ec41f7eTqbaFqMGU7lJG09vlEt0TQ tools/control/web/tmpl/index.tmpl 3ec41f7ed6_QZ1mg0vuA9Xu1wu1plw tools/control/web/tmpl/install.pl 3ec41f7emmAnjM4gsW6JWkqsjfi4Rg tools/control/web/tmpl/makefile +3f0d3c5bP8omJUhjEmXpsRvOZH3igw tools/control/web/tmpl/pd-g.tmpl +3f0d3c5bpmNu22iZ8mb-9hzOZUWEZw tools/control/web/tmpl/pd-gr.tmpl +3f0d3c5b1oQA8A-Y4AK0akN9k2T1KQ tools/control/web/tmpl/pd-l.tmpl +3f0d3c5bkJgUEumHh-qAL3ZB1xApSw tools/control/web/tmpl/pd-r.tmpl +3f0d3c5bOEOuHzB1HdWY9GvlYj7H-w tools/control/web/tmpl/pd-rr.tmpl +3f0d3c5cb9-AClRfExuRwJi45LcYuA tools/control/web/tmpl/pd.tmpl +3f0d3c5cQqQ23OpQJx-sNE0-EclRlA tools/control/web/tmpl/pdmenu.tmpl 3ec41f7eoDHD2raa4x6dBINr4QLO3A tools/control/web/tmpl/vd-fv.tmpl 3ec41f7eawycxV05Ow3LfZtOlHZJPA tools/control/web/tmpl/vd-pa.tmpl 3ec41f7ef4mVT4vwOEL40MKIzS4EeA tools/control/web/tmpl/vd-par.tmpl diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 71eac81846..d37d791d56 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -457,3 +457,9 @@ xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c~ xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c.bak xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c~ xenolinux-2.4.21-sparse/include/linux/blk.h~ +tools/control/web/pd-g.jsp +tools/control/web/pd-gr.jsp +tools/control/web/pd-l.jsp +tools/control/web/pd-r.jsp +tools/control/web/pd-rr.jsp +tools/control/web/pd.jsp diff --git a/tools/control/README-xenctl b/tools/control/README-web similarity index 95% rename from tools/control/README-xenctl rename to tools/control/README-web index 3ff9173ab2..f9cbe98bb9 100644 --- a/tools/control/README-xenctl +++ b/tools/control/README-web @@ -40,6 +40,6 @@ for development: ## edit xeno.bk/tools/control/build.properties # change manger.url to your xenoserver: mousetrap-0.xeno.cl.cam.ac.uk # change build.home to your xeno.bk full path - ## to "make install" in xeno.bk/tools/control instead of copying the war file + ## to "make install-web" in xeno.bk/tools/control instead of copying the war file cp $CATALINA_HOME/conf/tomcat-users.xml $CATALINA_HOME/conf/tomcat-users.orig sed -e 's//\ \ \ /' $CATALINA_HOME/conf/tomcat-users.orig > $CATALINA_HOME/conf/tomcat-users.xml diff --git a/tools/control/web/tmpl/index.tmpl b/tools/control/web/tmpl/index.tmpl index d1e158ff48..594d87cb96 100644 --- a/tools/control/web/tmpl/index.tmpl +++ b/tools/control/web/tmpl/index.tmpl @@ -45,6 +45,7 @@ COPYRIGHT&Computer Laboratory, University of Cambridge Domain Manager
Virtual Disk Manager
+ Physical Disk Manager
diff --git a/tools/control/web/tmpl/makefile b/tools/control/web/tmpl/makefile index 9e8ee2eca0..8e5e019832 100644 --- a/tools/control/web/tmpl/makefile +++ b/tools/control/web/tmpl/makefile @@ -5,7 +5,8 @@ src1 = index.jsp about.jsp help.jsp vd.jsp \ vd-par.jsp vd-vdcr.jsp vd-vddr.jsp vd-vdrr.jsp \ vd-vbdcr.jsp vd-vbdfr.jsp \ dom.jsp dom-lis.jsp dom-new.jsp dom-newr.jsp dom-sta.jsp dom-star.jsp \ - dom-stp.jsp dom-stpr.jsp dom-del.jsp dom-delr.jsp + dom-stp.jsp dom-stpr.jsp dom-del.jsp dom-delr.jsp \ + pd.jsp pd-g.jsp pd-gr.jsp pd-l.jsp pd-r.jsp pd-rr.jsp target = .. target0 = $(target)/xenostyle.css target1 = $(target)/index.jsp $(target)/vd.jsp \ @@ -19,7 +20,9 @@ target1 = $(target)/index.jsp $(target)/vd.jsp \ $(target)/dom.jsp $(target)/dom-lis.jsp $(target)/dom-new.jsp \ $(target)/dom-newr.jsp $(target)/dom-sta.jsp $(target)/dom-star.jsp \ $(target)/dom-stp.jsp $(target)/dom-stpr.jsp \ - $(target)/dom-del.jsp $(target)/dom-delr.jsp + $(target)/dom-del.jsp $(target)/dom-delr.jsp \ + $(target)/pd.jsp $(target)/pd-g.jsp $(target)/pd-gr.jsp \ + $(target)/pd-l.jsp $(target)/pd-r.jsp $(target)/pd-rr.jsp .SUFFIXES: .tmpl .jsp @@ -29,7 +32,7 @@ $(target)/index.jsp: index.tmpl ./install.pl -s -home index mv index.jsp $(target) -$(target)/%.jsp: %.tmpl +$(target)/%.jsp: %.tmpl xenofoot.def xenohead.def ./install.pl $* mv $*.jsp $(target) diff --git a/tools/control/web/tmpl/pd-g.tmpl b/tools/control/web/tmpl/pd-g.tmpl new file mode 100644 index 0000000000..824252a5c3 --- /dev/null +++ b/tools/control/web/tmpl/pd-g.tmpl @@ -0,0 +1,99 @@ +Grant Access +SECTION&XenoServers +BREADCRUMB&Physical Disk Manager&pd.jsp + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ +
+ + + + + +##WHITESPACE## ##GREYLINE1## ##WHITESPACE## + + + +##WHITESPACE## ##GREYLINE1## ##WHITESPACE## + + + + + + +
+ + + + + <% + int count = root.pm().getPartitionCount(); + for (int loop = 0; loop < count; loop++) + { + Partition p = root.pm().getPartition(loop); + if (p.isXeno() == true) + { + %> + + <% + } + else + { + %> + + + <% + } + %> + + + + + + + <% + } + %> + +
maj:minblocksstart sectnum sectsname
<%= p.getMajor() %>:<%= p.getMinor() %><%= p.getBlocks() %><%= p.getStartSect() %> <%= p.getNumSects() %> <%= p.getName() %>
+ +
+ + + + + + + + + + + + + + + + + + + + +
domain
RO + RW
+
+
+ +
+ + + + + diff --git a/tools/control/web/tmpl/pd-gr.tmpl b/tools/control/web/tmpl/pd-gr.tmpl new file mode 100644 index 0000000000..800d9ebc4e --- /dev/null +++ b/tools/control/web/tmpl/pd-gr.tmpl @@ -0,0 +1,77 @@ +Grant Access Results +SECTION&XenoServers +BREADCRUMB&Physical Disk Manager&pd.jsp + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ +Grant Access Results +
+ +<% + HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request); + Defaults d = sc.getDefaults(); + + String partitions[] = hsrw.getParameterValues("p"); + String size = null; + + if (partitions == null || partitions.length == 0) + { +%> +Error: No partitions chosen.
+<% + } + else if (hsrw.getParameter("domain") == null || + hsrw.getParameter("domain").trim().equals("")) + { +%> +Error: No domain specified.
+<% + } + else + { + int domain = -1; + + try + { + domain = Integer.decode(hsrw.getParameter("domain")).intValue(); + Mode mode; + if (hsrw.getParameter("mode").equals("rw")) { + mode = Mode.READ_WRITE; + } else { + mode = Mode.READ_ONLY; + } + + for (int i = 0; i < partitions.length; i++) + { +%> +output[<%= i %>] =
+<%= new CommandPhysicalGrant(d, domain, partitions[i], mode, false).execute() %>
+<% + } + } catch (NumberFormatException e) { +%> +Error: invalid domain specification.
+<% + } + } +%> + + +<% + root.doFlushState(); +%> + + +
+ + + + diff --git a/tools/control/web/tmpl/pd-l.tmpl b/tools/control/web/tmpl/pd-l.tmpl new file mode 100644 index 0000000000..795bdb011e --- /dev/null +++ b/tools/control/web/tmpl/pd-l.tmpl @@ -0,0 +1,90 @@ +Physical Access List +SECTION&XenoServers +BREADCRUMB&Physical Disk Manager&pd.jsp + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ +<% + CommandDomainList list = new CommandDomainList(sc.getDefaults()); + String output = list.executeWeb(); + if (output != null) + { +%> +<%= output %> +<% + } else { + Domain domains[] = list.domains(); +%> + + + + + <% + /* assert: domains != null, otherwise, where is the servlet engine? */ + for (int loop = 0; loop < domains.length; loop++) + { + if ( domains[loop].id == 0 ) + continue; + CommandPhysicalList plist = new CommandPhysicalList(sc.getDefaults(),domains[loop].id); + output = plist.executeWeb(); + if (output != null) + { +%> +<%= output %> +<% + } else { + Iterator i = plist.extents().entrySet().iterator(); + while (i.hasNext()) { + Entry entry = (Entry) i.next(); + Extent e = (Extent) entry.getKey(); + String mode = entry.getValue().toString(); + Partition p = root.pm().getPartition(e); + if (p != null) { + %> + + + + + + + + + + <% + } else { + %> + + + + + + + + + + <% + } + } + } + } + %> + +
domain
id
modemaj:minblocksstart sectnum sectsname
<%= domains[loop].id %><%= mode %><%= p.getMajor() %>:<%= p.getMinor() %><%= p.getBlocks() %><%= p.getStartSect() %> <%= p.getNumSects() %> <%= p.getName() %>
<%= domains[loop].id %><%= mode %><%= e.getMajor() %>:<%= e.getMinor()|e.getPartitionNo() %><%= e.getOffset() %> <%= e.getSize() %>
+<% + } +%> + +
+ + + + + diff --git a/tools/control/web/tmpl/pd-r.tmpl b/tools/control/web/tmpl/pd-r.tmpl new file mode 100644 index 0000000000..87f19e2ad4 --- /dev/null +++ b/tools/control/web/tmpl/pd-r.tmpl @@ -0,0 +1,104 @@ +Revoke Access +SECTION&XenoServers +BREADCRUMB&Physical Disk Manager&pd.jsp + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ +<% + CommandDomainList list = new CommandDomainList(sc.getDefaults()); + String output = list.executeWeb(); + if (output != null) + { +%> +<%= output %> +<% + } else { + Domain domains[] = list.domains(); +%> + +
+ + + + +##WHITESPACE## ##GREYLINE1## ##WHITESPACE## + + + + +
+ + + + <% + /* assert: domains != null, otherwise, where is the servlet engine? */ + for (int loop = 0; loop < domains.length; loop++) + { + if ( domains[loop].id == 0 ) + continue; + CommandPhysicalList plist = new CommandPhysicalList(sc.getDefaults(),domains[loop].id); + output = plist.executeWeb(); + if (output != null) + { +%> +<%= output %> +<% + } else { + Iterator i = plist.extents().entrySet().iterator(); + while (i.hasNext()) { + Entry entry = (Entry) i.next(); + Extent e = (Extent) entry.getKey(); + String mode = entry.getValue().toString(); + Partition p = root.pm().getPartition(e); + if (p != null) { + %> + + + + + + + + + + + <% + } else { + %> + + + + + + + + + + <% + } + } + } + } + %> + +
domain
id
modemaj:minblocksstart sectnum sectsname
"><%= domains[loop].id %><%= mode %><%= p.getMajor() %>:<%= p.getMinor() %><%= p.getBlocks() %><%= p.getStartSect() %> <%= p.getNumSects() %> <%= p.getName() %>
<%= domains[loop].id %><%= mode %><%= e.getMajor() %>:<%= e.getMinor()|e.getPartitionNo() %><%= e.getOffset() %> <%= e.getSize() %>
+
+
+<% + } +%> + +
+ + + + + diff --git a/tools/control/web/tmpl/pd-rr.tmpl b/tools/control/web/tmpl/pd-rr.tmpl new file mode 100644 index 0000000000..51d184359a --- /dev/null +++ b/tools/control/web/tmpl/pd-rr.tmpl @@ -0,0 +1,50 @@ +Revoke Access +SECTION&XenoServers +BREADCRUMB&Physical Disk Manager&pd.jsp + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ +Revoke Access Results +
+<% + HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request); + + String partitions[] = hsrw.getParameterValues("dompart"); + if (partitions == null || partitions.length == 0) + { +%> +Error: No partitions chosen.
+<% + } + else + { + for (int i = 0; i < partitions.length; i++) + { + int domain = Integer.parseInt(partitions[i].substring(0,partitions[i].indexOf(" "))); + String partition = partitions[i].substring(partitions[i].indexOf(" ")+1); +%> +output[<%= i %>] =
+<%= new CommandPhysicalRevoke(sc.getDefaults(),domain,partition).execute() %>
+<% + } + } +%> + +<% + root.doFlushState(); +%> + +
+ + + + + diff --git a/tools/control/web/tmpl/pd.tmpl b/tools/control/web/tmpl/pd.tmpl new file mode 100644 index 0000000000..60389228bc --- /dev/null +++ b/tools/control/web/tmpl/pd.tmpl @@ -0,0 +1,24 @@ +Physical Disk Manager +SECTION&XenoServers + + + + + + +INCLUDE&pdmenu.tmpl + + +
+ + + + + +
Physical Disk Manager
+
+ + + + + diff --git a/tools/control/web/tmpl/pdmenu.tmpl b/tools/control/web/tmpl/pdmenu.tmpl new file mode 100644 index 0000000000..9060a96114 --- /dev/null +++ b/tools/control/web/tmpl/pdmenu.tmpl @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + +
Grant
Revoke
List
+ + + + + + + diff --git a/tools/control/web/tmpl/xenohead.def b/tools/control/web/tmpl/xenohead.def index 12b957a1df..adafeefca4 100644 --- a/tools/control/web/tmpl/xenohead.def +++ b/tools/control/web/tmpl/xenohead.def @@ -9,6 +9,7 @@ <%@ page import="org.xenoserver.control.*" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Date" %> +<%@ page import="java.util.Map.Entry" %> <%@ page import="javax.servlet.http.HttpServletRequestWrapper" %> -- 2.30.2